#include <map>
#include "../GUI.h"
#include "Core/Memory/HeapObject.h"
#include "Core/GUI/Application/IApplication.h"

#ifndef _GUI_APPLICATION_WIN32_
#define _GUI_APPLICATION_WIN32_

namespace GUI
{
	namespace Win32
	{
		class Window;

		class Application : public Core::GUI::IApplication, public Core::Memory::HeapObject
		{
		public:
			Application();
			GUI_WIN32 virtual ~Application();
			GUI_WIN32 virtual Core::GUI::IWindow * CreateWindowApp(const std::string & _strName, uint32 _iWidth, uint32 _iHeight);
			GUI_WIN32 virtual void DestroyWindowApp(Core::GUI::IWindow * _pWindow);

			/*GUI_WIN32 virtual Core::GUI::IVerticalLayout * CreateVerticalLayout(int _iWidth, int _iHeight, Core::GUI::eHorizontalJustify _hJusitfy, Core::GUI::eVerticalJustify _vJusitfy);
			GUI_WIN32 virtual Core::GUI::IVerticalLayout * CreateVerticalLayout(int _iWidth, int _iHeight, Core::GUI::eHorizontalJustify _hJusitfy, Core::GUI::eVerticalJustify _vJusitfy, int _iMarginX, int _iMarginY, int _iPaddingX, int _iPaddingY);
			GUI_WIN32 virtual void DestroyVerticalLayout(Core::GUI::IVerticalLayout * _pVerticalLayout);
			
			GUI_WIN32 virtual Core::GUI::IHorizontalLayout * CreateHorizontalLayout(int _iWidth, int _iHeight, Core::GUI::eHorizontalJustify _hJusitfy, Core::GUI::eVerticalJustify _vJusitfy);
			GUI_WIN32 virtual Core::GUI::IHorizontalLayout * CreateHorizontalLayout(int _iWidth, int _iHeight, Core::GUI::eHorizontalJustify _hJusitfy, Core::GUI::eVerticalJustify _vJusitfy, int _iMarginX, int _iMarginY, int _iPaddingX, int _iPaddingY);
			GUI_WIN32 virtual void DestroyHorizontalLayout(Core::GUI::IHorizontalLayout * _pHorizontalLayout);

			GUI_WIN32 virtual Core::GUI::IButton * CreateButton(const std::string & _strName);
			GUI_WIN32 virtual Core::GUI::IButton * CreateButton(const std::string & _strName, int _iWidth, int _iHeight);
			GUI_WIN32 virtual void DestroyButton(Core::GUI::IButton * _pButton);

			GUI_WIN32 virtual Core::GUI::ISlider * CreateSlider(int _iMin, int _iMax, int _iDefaultValue);
			GUI_WIN32 virtual Core::GUI::ISlider * CreateSlider(int _iMin, int _iMax, int _iDefaultValue, int _iWidth, int _iHeight);
			GUI_WIN32 virtual void DestroySlider(Core::GUI::ISlider * _pSlider);

			GUI_WIN32 virtual Core::GUI::ITab * CreateTab();
			GUI_WIN32 virtual Core::GUI::ITab * CreateTab(int _iWidth, int _iHeight);
			GUI_WIN32 virtual void DestroyTab(Core::GUI::ITab * _pTab);*/

			static int GetId() { return ++ms_idGenerator; }
			static void RegisterWidget(Core::GUI::IWidget * _pWidget);
			static void UnregisterWidget(Core::GUI::IWidget * _pWidget);

			static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

		private:
			static int ms_idGenerator;
			static std::map<int, Core::GUI::IWidget*> ms_WidgetList;
			std::vector<Window*> m_WindowList;
			
		};
	}
}

#endif // _GUI_APPLICATION_WIN32_